console.log('mo app server.');
var svrInfoLib = require('./svrinfo.js')
var mysqlLib = require('./mysql.js')
console.log(svrInfoLib);
class TWebApi {
    constructor() {
        this.port = 3000;

        this.express = require('express');
        this.app = this.express();
        this.svrInfo = new svrInfoLib.TSvrInfo();
        this.mysql = new mysqlLib.TMySql();
        console.log(this.svrInfo);
    }

    registRoutes() {
        this.app.all('/iot', (_request, response) => {
            response.send('iot')
        })
        this.app.all('/svrinfo/svrTime', (_request, response) => {
            var svrTm = this.svrInfo.getSvrTime().toString();
            response.send(svrTm)
        })
    }

    start() {
        this.registRoutes();
        this.app.listen(3000, () => {
            console.log('服务器已启动')
        })

    }
}

const webSvrApi = new TWebApi();
webSvrApi.start();